Crystals

Below are some simple 3D crystals drawn in Mathematica.

FCC Lattice

First define the lattice vectors:

a=1.0;
a1=(a/2){1,1,0};
a2=(a/2){0,1,1};
a3=(a/2){1,0,1};

The variable rad is simply the radius of the sphere we will draw at each point.  The variable crystal is a list of graphics commands to draw spheres at different spots.  We loop through indices m, n, and p using the Table  command, which produces a list of lists of lists (we nest one level for each looping variable.)   We turn that into a simple list using the Flatten command.  Graphics3D takes the list of graphics commands and executes them.

rad=.1;crystal=Flatten[Table[Sphere[p a1+m a2+n a3,rad],{m,-3,3},{n,-3,3},{p,-3,3}]];
Graphics3D[crystal]

Ok - this is a bit much.  Let's chop it down to a chunk, by specifying the range of the plot.

b=1.25;
Graphics3D[crystal,PlotRange-> {{-b,b},{-b,b},{-b,b}}]

BCC Lattice:

Define the lattice vectors:

a=1.0;
a1=(a/2){1,1,-1};
a2=(a/2){-1,1,1};
a3=(a/2){1,-1,1};

This works exactly the same as above, except we are using the Cuboid command to draw cubes.   This command wants to know the position of two corners of the cube.

rad=.2;crystal=Flatten[Table[q1=p a1+m a2+n a3;q2=q1+rad*{1,1,1};Cuboid[q1,q2],{m,-3,3},{n,-3,3},{p,-3,3}]];
Graphics3D[crystal]

b=1.25;
Graphics3D[crystal,PlotRange-> {{-b,b},{-b,b},{-b,b}}]